<h1><a href="<?php echo $this->url(array("controller" => "products", "action" => "list-products"), "admin", true); ?>"><?php echo $this->translate->_("Products"); ?></a> &raquo; <?php echo $this->translate->_("List Flags"); ?></h1>
<div class="rbcontent" id="search_fields">
	<form name="search" action="<?php echo $this->url; ?>" method="get">
	<input type="hidden" name="order" id="order" value="<?php echo $this->order; ?>" />
	<input type="hidden" name="dir" id="dir" value="<?php echo $this->dir; ?>" />
	<table>
	<col width="430" />
		<tr>
			<td>
				<div class="filter_item">
					<label><?php echo $this->translate->_("User"); ?>:</label>
					<input type="text" name="user" value="<?php echo $this->user; ?>" />
				</div>
			</td>
			<td></td>
		</tr>
		<tr>
			<td>
				<div class="filter_item">
					<label><?php echo $this->translate->_("Reason"); ?>:</label>
					<input type="text" name="reason" value="<?php echo $this->reason; ?>" />
				</div>

			</td>
			<td>
				<div class="filter_item">
					<label></label>
					<input type="button" value="<?php echo $this->translate->_("Search"); ?>" data-type="submit" />
					<input type="button" value="<?php echo $this->translate->_("Reset"); ?>" data-type="reset" />
				</div>
			</td>
		</tr>
	</table>
	</form>
</div>
<?php if(count($this->flags) > 0): ?>
	<?php echo $this->paginationControl($this->flags, 'Elastic', 'controls.phtml', array('translate' => $this->translate)); ?>
	<table class="main">
		<thead>
			<tr>
				<th class="<?php $col = "x.name"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("User"); ?></th>
				<th class="<?php $col = "z.value"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("Category"); ?></th>
				<th class="<?php $col = "y.value"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("Reason"); ?></th>
				<th class="<?php $col = "a.date_flagged"; echo strcasecmp($this->order, $col) == 0 ? strcasecmp($this->dir, "asc") == 0 ? "sortable selectedUp" : "sortable selectedDown" : "sortable"; ?>" nowrap="nowrap" data-col="<?php echo $col; ?>"><?php echo $this->translate->_("Date Flagged"); ?></th>
				<th width="1%"></th>
			</tr>
		</thead>
		<tbody>
			<?php foreach($this->flags as $flag): ?>
				<tr>
					<td><a href="<?php echo $this->url(array('controller'=>'members', 'action'=>'edit-user', 'id'=> $flag["user_id"]), 'admin', true); ?>"><?php echo $flag['user_name']; ?></a></td>
					<td><?php echo $flag['reason_category']; ?></td>
					<td><?php echo $flag['reason_name']; ?></td>
					<td><?php echo Petolio_Service_Util::formatDate($flag["date_flagged"], null, true, true); ?></td>
					<td nowrap="nowrap" style="text-align: center;"><a href="<?php echo $this->url(array('controller'=>'products', 'action'=>'delete-flag', 'id'=> $flag["id"]), 'admin', true); ?>" class="reqconf" title="<?php echo $this->translate->_("Are you sure you want to delete this flag?"); ?>"><?php echo $this->translate->_("Delete"); ?></a></td>
				</tr>
			<?php endforeach; ?>
		</tbody>
	</table>
	<?php echo $this->paginationControl($this->flags, 'Elastic', 'controls.phtml', array('translate' => $this->translate)); ?>
<?php else: ?>
	<div class="error"><?php echo $this->translate->_("No records found."); ?></div>
<?php endif; ?>
<script type="text/javascript">
	READY(function() {
		Admin.loadJs('filters/base.js');
		Filters.load('/products/list-flags/id/<?php echo $this->id; ?>');
	});
</script>